package com.pott.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SuggestBox;
import com.googlecode.mgwt.mvp.client.Animation;
import com.googlecode.mgwt.ui.client.MGWT;
import com.googlecode.mgwt.ui.client.MGWTSettings;
import com.googlecode.mgwt.ui.client.animation.AnimationHelper;
import com.googlecode.mgwt.ui.client.widget.Button;
import com.googlecode.mgwt.ui.client.widget.LayoutPanel;
import com.google.gwt.user.client.ui.Grid;

public class MyEntryPoint implements EntryPoint {

	@Override
	public void onModuleLoad() {
	    // set viewport and other settings for mobile
	    MGWT.applySettings(MGWTSettings.getAppSetting());

	    // build animation helper and attach it
	    AnimationHelper animationHelper = new AnimationHelper();
	    RootPanel rootPanel = RootPanel.get();
	    rootPanel.add(animationHelper);
	    
	    Grid grid = new Grid(1, 1);
	    rootPanel.add(grid, 106, 47);
	    grid.setSize("127px", "146px");

	    // build some UI
	    LayoutPanel layoutPanel = new LayoutPanel();
	    Button button = new Button("Hello mgwt");
	    layoutPanel.add(button);

	    MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
	    oracle.add("Cat");
	    oracle.add("Dog");
	    oracle.add("Horse");
	    oracle.add("Canary");

	    SuggestBox box = new SuggestBox(oracle);
	    layoutPanel.add(box);

	    
	    // animate
	    animationHelper.goTo(layoutPanel, Animation.SLIDE_UP);
	}
}
